import {
  HTTP
} from '../utils/http.js'
class ClassMode extends HTTP {
  //this指向的是new HTTP
  constructor() {
    super()
    this.state = {
      Stoarge: []
    }
  }



  _getStorage(index, callback) {
    let classDataSum_S = wx.getStorageSync('classDataSum')
    let classData_S = wx.getStorageSync('classDatanew')[index]
    if (!classData_S) {
      this.request({
        url: 'musicRankingsDetails?type=2',
        success: (res) => {
          let classData = res.result[index]
          let classDataSum = res.result
          let tags = classData.album_500_500.length - 16
          classData.imgUrl = classData.album_500_500.substr(0, tags)
          callback(classData, classDataSum)
          this.state.Stoarge.push(classData)
          wx.setStorageSync('classDatanew', this.state.Stoarge)
          wx.setStorageSync('classDataSum', classDataSum)
        }
      })
    } else {
      callback(classData_S, classDataSum_S)
    }
  }



}



export {
  ClassMode
}


// delete 对象.key  删除对象